package com.compty.paint.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @Todo:订单明细
 * @CreateTime:2011-6-2 上午11:11:10
 */
@Entity
@Table(name = "t_orderitem")
public class OrderItem implements java.io.Serializable {

	private static final long serialVersionUID = -3915268278581964704L;

	private Long id;

	/************ 订单 ****************/
	private Order order;
	
	private Integer num;//商品数量
	private Integer ship_num;//邮寄数量
	private String name;//商品名称
	private String sn;//商品编号
	private Integer store; // 对应货品的库存
	private String addon;

	private Double price;//单价
	private int gainedpoint;//积分
	
	private Goods goods;//商品
	private Bid bid;//关联拍品(已拍出的拍品)
	private Long belongTo;//商品所有者

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "order_id")
	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "goods_id")
	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@Column(name = "num")
	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	@Column(name = "ship_num")
	public Integer getShip_num() {
		return ship_num;
	}

	public void setShip_num(Integer shipNum) {
		ship_num = shipNum;
	}

	@Column(name = "name",length = 100)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "sn",length = 50)
	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}

	@Column(name = "store")
	public Integer getStore() {
		return store;
	}

	public void setStore(Integer store) {
		this.store = store;
	}

	@Column(name = "addon",length = 50)
	public String getAddon() {
		return addon;
	}

	public void setAddon(String addon) {
		this.addon = addon;
	}

	@Column(name = "price")
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Column(name = "gainedpoint")
	public int getGainedpoint() {
		return gainedpoint;
	}

	public void setGainedpoint(int gainedpoint) {
		this.gainedpoint = gainedpoint;
	}

	@Transient
	public Bid getBid() {
		return bid;
	}

	public void setBid(Bid bid) {
		this.bid = bid;
	}

	@Column(name = "belongto")
	public Long getBelongTo() {
		return belongTo;
	}

	public void setBelongTo(Long belongTo) {
		this.belongTo = belongTo;
	}

}
